home *** CD-ROM | disk | FTP | other *** search
/ IRIX Base Documentation 2002 November / SGI IRIX Base Documentation 2002 November.iso / usr / share / catman / p_man / cat3 / il_c / ilWarp.z / ilWarp
Encoding:
Text File  |  2002-10-03  |  17.2 KB  |  397 lines

  1.  
  2.  
  3.  
  4. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  5.  
  6.  
  7.  
  8. NNNNAAAAMMMMEEEE
  9.      iiiillllWWWWaaaarrrrpppp - general 3D warp operations
  10.  
  11. IIIINNNNHHHHEEEERRRRIIIITTTTSSSS FFFFRRRROOOOMMMM
  12.      ilWatchedObject
  13.  
  14. HHHHEEEEAAAADDDDEEEERRRR FFFFIIIILLLLEEEE
  15.      #include <il/ilCdefs.h>
  16.  
  17. CCCCLLLLAAAASSSSSSSS DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
  18.      The ilWarp class encapsulates general 3D coordinate transformations for
  19.      use by ilWarpImg and subclasses thereof.  A particular warp is defined by
  20.      overriding the eeeevvvvaaaallll() virtual.  Several other virtuals can be overridden
  21.      to enable more efficient batch evaluation, inversion, composition, and so
  22.      forth.
  23.  
  24.      The ilWarp class contains one pure virtual method, ccccooooppppyyyy(), so it is not
  25.      possible to construct an ilWarp object, and any concrete derived class
  26.      must implement the copy virtual.  The ilWarpImg operator relies on the
  27.      copy method to maintain an internal copy of a user-supplied warp.
  28.  
  29.      ilWarp is derived from ilWatchedObject.  This makes it possible to set a
  30.      "dynamic" warp object on an ilWarpImg --- one that is not copied, but
  31.      instead "watched" for any changes.  When the warp changes, the ilWarpImg
  32.      responds appropriately.  This implies that any class that is derived from
  33.      ilWarp must trigger the appropriate notification whenever it is changed.
  34.      In particular the non-const virtual methods iiiiddddeeeennnnttttiiiittttyyyy(), iiiinnnnvvvveeeerrrrtttt(),
  35.      ccccoooommmmppppoooosssseeee(), and iiiinnnnffffeeeerrrr() should call the protected method wwwwaaaarrrrppppCCCChhhhaaaannnnggggeeeedddd().
  36.      (However, if any of these methods fails and leaves the warp unchanged the
  37.      wwwwaaaarrrrppppCCCChhhhaaaannnnggggeeeedddd() method should not be called.)
  38.  
  39.      ilWarp provides several alternative means to evaluate the warp that it
  40.      specifies.  The principal one is eeeevvvvaaaallll() which must be defined by a
  41.      derived class.  The others are xxxx(), yyyy(), and zzzz(), which evaluate the
  42.      components of the warp, ddddxxxx(), ddddyyyy(), and ddddzzzz(), which evaluate the Jacobian
  43.      of the warp,
  44.  
  45. CCCCLLLLAAAASSSSSSSS MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN SSSSUUUUMMMMMMMMAAAARRRRYYYY
  46.      CCCCooooppppyyyyiiiinnnngggg
  47.  
  48.           virtual ilWarp* ilWarpCopy(ilWarp *obj)
  49.  
  50.      WWWWaaaarrrrpppp eeeevvvvaaaalllluuuuaaaattttiiiioooonnnn mmmmeeeetttthhhhooooddddssss
  51.  
  52.           virtual void ilWarpEval3D(ilWarp *obj, float* x, float* y,
  53.                                     float* z, float u, float v,
  54.                                     float w)
  55.           void ilWarpEval(ilWarp *obj, float* x, float* y, float u,
  56.                           float v)
  57.           virtual float ilWarpX(ilWarp *obj, float u, float v, float w)
  58.           virtual float ilWarpY(ilWarp *obj, float u, float v, float w)
  59.           virtual float ilWarpZ(ilWarp *obj, float u, float v, float w)
  60.  
  61.  
  62.  
  63.                                                                         PPPPaaaaggggeeee 1111
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  71.  
  72.  
  73.  
  74.           virtual void ilWarpDx(ilWarp *obj, float* x, float* y,
  75.                                 float* z, float u, float v, float w)
  76.           virtual void ilWarpDy(ilWarp *obj, float* x, float* y,
  77.                                 float* z, float u, float v, float w)
  78.           virtual void ilWarpDz(ilWarp *obj, float* x, float* y,
  79.                                 float* z, float u, float v, float w)
  80.           virtual ilStatus ilWarpGetBBox(ilWarp *obj, iflXYZfloat* min,
  81.                                          iflXYZfloat* max, int su,
  82.                                          int sv, int sw, int nu,
  83.                                          int nv, int nw)
  84.           ilStatus ilWarpGetBBox2D(ilWarp *obj, iflXYZfloat* min,
  85.                                    iflXYZfloat* max, int su, int sv,
  86.                                    int nu, int nv)
  87.           virtual void ilWarpEvalVector(ilWarp *obj, float upos,
  88.                                         float vpos, float ustep,
  89.                                         iflXYfloat *addrs, int count,
  90.                                         float wpos)
  91.           void ilWarpFindRoot(ilWarp *obj, const iflXYZfloat* xy,
  92.                               iflXYZfloat* uv, int tries, float xyzTol,
  93.                               float uvwTol)
  94.  
  95.      WWWWaaaarrrrpppp mmmmaaaannnniiiippppuuuullllaaaattttiiiioooonnnn
  96.  
  97.           virtual void ilWarpIdentity(ilWarp *obj)
  98.           virtual ilStatus ilWarpInvert(ilWarp *obj, ilWarpQuality quality,
  99.                                         float ulo, float uhi,
  100.                                         float vlo, float vhi,
  101.                                         float wlo, float whi)
  102.           virtual ilStatus ilWarpCompose(ilWarp *obj, const ilWarp* other,
  103.                                          ilWarpQuality quality)
  104.           virtual ilStatus ilWarpInfer(ilWarp *obj,
  105.                                        ilTiePointList* tiePoints,
  106.                                        ilWarpQuality quality)
  107.           virtual int ilWarpMinimumNumberOfTies(ilWarp *obj)
  108.  
  109.      AAAAlllltttteeeerrrraaaattttiiiioooonnnn ccccaaaallllllllbbbbaaaacccckkkk mmmmeeeetttthhhhooooddddssss
  110.  
  111. FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNN DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNNSSSS
  112.      ccccoooommmmppppoooosssseeee(((())))
  113.  
  114.           virtual ilStatus ilWarpCompose(ilWarp *obj, const ilWarp* other,
  115.                                          ilWarpQuality quality)
  116.  
  117.  
  118.           Compose this warp with another. This object is updated to reflect
  119.           the composite transformation equivalent to applying
  120.           (*this)(other(p)).  The default implementation returns ilFAILED.  If
  121.           quality is ilWarpExact, then the method should return ilOKAY only if
  122.           the precise composition can be computed.  Otherwise it should return
  123.           ilFAILED.  If quality is ilWarpBest, then the method can return
  124.           ilAPPROXIMATE if only an approximate composition can be computed.
  125.           If the composition operation fails, then this object should be
  126.  
  127.  
  128.  
  129.                                                                         PPPPaaaaggggeeee 2222
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  137.  
  138.  
  139.  
  140.           unmodified.
  141.  
  142.      ccccooooppppyyyy(((())))
  143.  
  144.           virtual ilWarp* ilWarpCopy(ilWarp *obj)
  145.  
  146.  
  147.           This is a pure virtual method that allocates a duplicate of the warp
  148.           object.  It is used by ilWarpImg to maintain an internal copy of the
  149.           warp passed by ilWarpImg::setWarp().
  150.  
  151.      ddddxxxx(((())))
  152.  
  153.           virtual void ilWarpDx(ilWarp *obj, float* x, float* y,
  154.                                 float* z, float u, float v, float w)
  155.  
  156.  
  157.           Evaluate the partial derivatives (dx/du,dy/du,dz/du) of the warp
  158.           function at the point (u,v,w).  The default implementation returns
  159.           zeros.
  160.  
  161.      ddddyyyy(((())))
  162.  
  163.           virtual void ilWarpDy(ilWarp *obj, float* x, float* y,
  164.                                 float* z, float u, float v, float w)
  165.  
  166.  
  167.           Evaluate the partial derivatives (dx/dv,dy/dv,dz/dv) of the warp
  168.           function at the point (u,v,w).  The default implementation returns
  169.           zeros.
  170.  
  171.      ddddzzzz(((())))
  172.  
  173.           virtual void ilWarpDz(ilWarp *obj, float* x, float* y,
  174.                                 float* z, float u, float v, float w)
  175.  
  176.  
  177.           Evaluate the partial derivatives (dx/dw,dy/dw,dz/dw) of the warp
  178.           function at the point (u,v,w).  The default implementation returns
  179.           zeros.
  180.  
  181.      eeeevvvvaaaallll(((())))
  182.  
  183.           virtual void ilWarpEval3D(ilWarp *obj, float* x, float* y,
  184.                                     float* z, float u, float v,
  185.                                     float w)
  186.  
  187.  
  188.           void ilWarpEval(ilWarp *obj, float* x, float* y, float u,
  189.                           float v)
  190.  
  191.  
  192.  
  193.  
  194.  
  195.                                                                         PPPPaaaaggggeeee 3333
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  203.  
  204.  
  205.  
  206.           This is a convenience method to evaluate all three coordinates of
  207.           the transformation and return the result in a structure.  The 2D
  208.           version assumes that w = 0.
  209.  
  210.      eeeevvvvaaaallllVVVVeeeeccccttttoooorrrr(((())))
  211.  
  212.           virtual void ilWarpEvalVector(ilWarp *obj, float upos,
  213.                                         float vpos, float ustep,
  214.                                         iflXYfloat *addrs, int count,
  215.                                         float wpos)
  216.  
  217.  
  218.           Perform the equivalent of
  219.  
  220.           for (int i=0; i<count; i++) {
  221.               float z;
  222.               eval(addrs[i].x, addrs[i].y, z, upos+ustep*i, vpos, wpos);
  223.           }
  224.  
  225.  
  226.           for use by the ilWarpImg address generation function.  This function
  227.           should be optimized as much as possible by derived classes in order
  228.           to achieve good ilWarpImg performance.
  229.  
  230.      ffffiiiinnnnddddRRRRooooooootttt(((())))
  231.  
  232.           void ilWarpFindRoot(ilWarp *obj, const iflXYZfloat* xyz,
  233.                               iflXYZfloat* uvw, int tries, float xyzTol,
  234.                               float uvwTol)
  235.  
  236.  
  237.           Search numerically for the solution to
  238.  
  239.               xyz = warp(uvw).
  240.  
  241.  
  242.           The search terminates when one of the following conditions is met:
  243.           (1) the number of iterations exceeds _t_r_i_e_s, (2) the difference
  244.           between successive approximations is <= _x_y_z_T_o_l, or (3) the
  245.           difference between (_x_y_z) and warp(_u_v_w) is <= _u_v_w_T_o_l.
  246.  
  247.      ggggeeeettttBBBBBBBBooooxxxx(((())))
  248.  
  249.           ilStatus ilWarpGetBBox2D(ilWarp *obj, iflXYZfloat* min,
  250.                                    iflXYZfloat* max, int su, int sv,
  251.                                    int nu, int nv)
  252.           virtual ilStatus ilWarpGetBBox(ilWarp *obj, iflXYZfloat* min,
  253.                                          iflXYZfloat* max, int su,
  254.                                          int sv, int sw, int nu,
  255.                                          int nv, int nw)
  256.  
  257.  
  258.  
  259.  
  260.  
  261.                                                                         PPPPaaaaggggeeee 4444
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  269.  
  270.  
  271.  
  272.           Return the bounding box of the mapped rectangle with corners
  273.           (su,sv,sw) and (su+nu,sv+nv,sw+nw).  The lower-left and upper-right
  274.           vertices of the box are returned in the min and max structures,
  275.           respectively.  The default implementation is by sampling the
  276.           boundary of the input rectangle at a fixed granularity and computing
  277.           the bounding box of the mapped set of sample points.  It returns
  278.           ilOKAY if the computation is successful and ilFAILED otherwise.  The
  279.           2D version assumes sw == 0 and nw == 1.
  280.  
  281.      iiiiddddeeeennnnttttiiiittttyyyy(((())))
  282.  
  283.           virtual void ilWarpIdentity(ilWarp *obj)
  284.  
  285.  
  286.           Sets the warp to the identity function.  The default implementation
  287.           does nothing.
  288.  
  289.      iiiinnnnffffeeeerrrr(((())))
  290.  
  291.           virtual ilStatus ilWarpInfer(ilWarp *obj,
  292.                                        ilTiePointList* tiePoints,
  293.                                        ilWarpQuality quality)
  294.  
  295.  
  296.           Infer the warp from a set of point correspondences in the input and
  297.           output spaces.  See ccccoooommmmppppoooosssseeee() for the interpretation of the quality
  298.           argument.  The default implementation returns ilFAILED.  This method
  299.           must be defined by any subclass that will be used by ilTieWarpImg.
  300.  
  301.      iiiinnnnvvvveeeerrrrtttt(((())))
  302.  
  303.           virtual ilStatus ilWarpInvert(ilWarp *obj, ilWarpQuality quality,
  304.                                         float ulo, float uhi,
  305.                                         float vlo, float vhi,
  306.                                         float wlo, float whi)
  307.  
  308.  
  309.           Invert the warp over the domain specified by the rectangle
  310.           (ulo,vlo,wlo) to (uhi,vhi,whi).  The accuracy of the inverse outside
  311.           this rectangle is undefined.  See ccccoooommmmppppoooosssseeee() for the interpretation
  312.           of the quality argument.  The default implementation uses iiiinnnnffffeeeerrrr() to
  313.           guess the inverse via a set of tie points.
  314.  
  315.      mmmmiiiinnnniiiimmmmuuuummmmNNNNuuuummmmbbbbeeeerrrrOOOOffffTTTTiiiieeeessss(((())))
  316.  
  317.           virtual int ilWarpMinimumNumberOfTies(ilWarp *obj)
  318.  
  319.  
  320.           Return the minimum number of tie points necessary to infer the warp.
  321.           The default implementation returns INT_MAX.
  322.  
  323.  
  324.  
  325.  
  326.  
  327.                                                                         PPPPaaaaggggeeee 5555
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. iiiillllWWWWaaaarrrrpppp((((3333))))          IIIImmmmaaaaggggeeeeVVVViiiissssiiiioooonnnn LLLLiiiibbbbrrrraaaarrrryyyy CCCC++++++++ RRRReeeeffffeeeerrrreeeennnncccceeee MMMMaaaannnnuuuuaaaallll          iiiillllWWWWaaaarrrrpppp((((3333))))
  335.  
  336.  
  337.  
  338.      xxxx(((())))
  339.  
  340.           virtual float ilWarpX(ilWarp *obj, float u, float v, float w)
  341.  
  342.  
  343.           Evaluate the x component of the warp function at a point.  The
  344.           default implementation is to return u.  This virtual should be
  345.           overridden by any derived class that transforms the x component.
  346.  
  347.      yyyy(((())))
  348.  
  349.           virtual float ilWarpY(ilWarp *obj, float u, float v, float w)
  350.  
  351.  
  352.           Evaluate the y component of the warp function at a point.  The
  353.           default implementation is to return v.  This virtual should be
  354.           overridden by any derived class that transforms the y component.
  355.  
  356.      zzzz(((())))
  357.  
  358.           virtual float ilWarpZ(ilWarp *obj, float u, float v, float w)
  359.  
  360.  
  361.           Evaluate the z component of the warp function at a point.  The
  362.           default implementation is to return w.  This virtual should be
  363.           overridden by any derived class that transforms the z component.
  364.  
  365. IIIINNNNHHHHEEEERRRRIIIITTTTEEEEDDDD MMMMEEEEMMMMBBBBEEEERRRR FFFFUUUUNNNNCCCCTTTTIIIIOOOONNNNSSSS
  366.    IIIInnnnhhhheeeerrrriiiitttteeeedddd ffffrrrroooommmm iiiillllWWWWaaaattttcccchhhheeeeddddOOOObbbbjjjjeeeecccctttt
  367.      addWatchCallback(), doWatchCallbacks(), removeWatchCallback()
  368.  
  369.  
  370. SSSSEEEEEEEE AAAALLLLSSSSOOOO
  371.      ilWarpImg, ilPolyWarp, ilAffineWarp, ilPolyDef, ilTieWarpImg
  372.  
  373.  
  374.  
  375.  
  376.  
  377.  
  378.  
  379.  
  380.  
  381.  
  382.  
  383.  
  384.  
  385.  
  386.  
  387.  
  388.  
  389.  
  390.  
  391.  
  392.  
  393.                                                                         PPPPaaaaggggeeee 6666
  394.  
  395.  
  396.  
  397.